package com.eshop.tools.utils;

import com.eshop.utils.FileUtil;
import java.util.Date;
import java.text.SimpleDateFormat;
import com.qiniu.storage.Region;

public class QiNiuUtil
{
    private static final String HUAD = "华东";
    private static final String HUAB = "华北";
    private static final String HUAN = "华南";
    private static final String BEIM = "北美";
    
    public static Region getRegion(final String zone) {
        if ("华东".equals(zone)) {
            return Region.huadong();
        }
        if ("华北".equals(zone)) {
            return Region.huabei();
        }
        if ("华南".equals(zone)) {
            return Region.huanan();
        }
        if ("北美".equals(zone)) {
            return Region.beimei();
        }
        return Region.qvmHuadong();
    }
    
    public static String getKey(final String file) {
        final SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        final Date date = new Date();
        return FileUtil.getFileNameNoEx(file) + "-" + sdf.format(date) + "." + FileUtil.getExtensionName(file);
    }
}
